package com.my.blogapi.controller;

import com.my.blogapi.service.CategoryService;
import com.my.blogapi.vo.param.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("categorys")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;
    @GetMapping
    public Result categories(){
        return categoryService.findAll();
    }

//    detail  获取所有文章分类列表
    @GetMapping("detail")
    public Result findAllDetail(){
        Result result = categoryService.findAll();
        return result;
    }
    //    detail  获取所有文章分类列表
    @GetMapping("detail/{id}")
    public Result findDetailById(@PathVariable("id") Long id){
        Result result = categoryService.findDetailById(id);
        return result;
    }
}
